home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / System / BoingBag1 / Internet / AWeb / Plugins / HTTX / HTTXPluginCFG.awebrx < prev    next >
Text File  |  1999-10-02  |  13KB  |  284 lines

  1. /*
  2.     $VER: HTTXPluginCFG 3.0 (28.8.99) by Gabriele Favrin
  3.     HTTXPlugin configuration script
  4. */
  5.  
  6. options results
  7.  
  8. if ~Show('L', 'rexxsupport.library') then do
  9.     call addlib('rexxsupport.library', 0, -30, 0)      
  10. end
  11.  
  12. call InitPipe()
  13. call Init()
  14. call LoadSettings()
  15. call ManageGUI()
  16.  
  17. exit 0
  18.  
  19.  
  20. InitPipe:
  21.     if Showlist('H', 'AWNPIPE') then res=open(gui_fp, 'awnpipe:/-2010/xc', 'W')
  22.     if res ~= 1 then do
  23.         'request NOWAIT "Error" "To use this program you need AWNPipe:*N        (Vers 2.10 or newer).*NInstall AWeb 3.3SE from the AWeb install script*Nor click on the CLICK ME icon in the AWeb drawer." "OK"'
  24.         exit 0
  25.     end
  26.     return
  27.  
  28.  
  29. Init:
  30.     save_len=77; save_indent=3; save_ansimode=0; save_ansicol=3; save_7bit=0; save_hrmode=1;
  31.     save_noalign=0; save_tdeol=0; save_setnote=0; save_href=0; save_img=0; save_script=0; save_badhtml=0
  32.  
  33.     print_len=77; print_indent=3; print_ansimode=0; print_ansicol=4; print_7bit=0; print_hrmode=1
  34.     print_noalign=0; print_tdeol=0; print_href=0; print_img=0; print_script=0; print_badhtml=0
  35.  
  36.     prefs_info=0; prefs_report=1; prefs_preview=0; prefs_savedir="ram:"; prefs_print_noheader=0
  37.     prefs_save_noheader=0; prefs_donotaskdir=0
  38.  
  39.     opt_noalign.0=''; opt_noalign.1=' NOALIGN'
  40.     opt_tdeol.0=''; opt_tdeol.1=' TDEOL'
  41.     opt_7bit.0=''; opt_7bit.1=' 7BIT'
  42.     opt_href.0=''; opt_href.1=' HREF'
  43.     opt_img.0=''; opt_img.1=' IMG'
  44.     opt_script.0=''; opt_script.1=' SCRIPT'
  45.     opt_badhtml.0=''; opt_badhtml.1=' BADHTML'
  46.     eol='0A'x
  47.  
  48.     'Get SCREEN var' awebscreen
  49.     return
  50.  
  51.  
  52. LoadSettings:
  53.     if Open(rcfg_fp, 'ENV:HTTXPlugin.config', 'R') then do
  54.         cfg=ReadLN(rcfg_fp)
  55.  
  56.         if Left(cfg, 6) == "prefs_" then do
  57.             interpret translate(strip(cfg), ';',' ')
  58.             prefs_savedir=Translate(prefs_savedir, ' ', ';')
  59.         end
  60.         call Close(rcfg_fp)
  61.     end
  62.  
  63.     if Open(save_config_fp, "ENV:HTTX.prefs", 'R') then do
  64.         save_config_string = Upper(ReadLN(save_config_fp))
  65.         Call Close(save_config_fp)
  66.  
  67.         if Pos('LEN=', save_config_string) > 0 then
  68.             parse VAR save_config_string 'LEN='save_len . 
  69.  
  70.         if Pos('INDENT=', save_config_string) > 0 then
  71.             parse VAR save_config_string 'INDENT='save_indent . 
  72.  
  73.         if Pos('ANSIMODE=', save_config_string) > 0 then
  74.             parse VAR save_config_string 'ANSIMODE='save_ansimode . 
  75.         else if (Pos('ANSI ', save_config_string) > 0) | (right(save_config_string, 4) = 'ANSI') then
  76.             save_ansimode=2
  77.  
  78.         if Pos('ANSICOL=', save_config_string) > 0 then
  79.             parse VAR save_config_string 'ANSICOL='save_ansicol . 
  80.  
  81.         if Pos('HRMODE=', save_config_string) > 0 then
  82.             parse VAR save_config_string 'HRMODE='save_hrmode . 
  83.  
  84.         if Pos('SETNOTE=', save_config_string) > 0 then
  85.             parse VAR save_config_string 'SETNOTE='save_setnote . 
  86.         else if (Pos('FILENOTE ', save_config_string) > 0) | (right(save_config_string, 8) = 'FILENOTE') then
  87.             save_setnote=1
  88.  
  89.         save_noalign=Pos('NOALIGN', save_config_string) > 0
  90.         save_tdeol=Pos('TDEOL', save_config_string) > 0
  91.         save_7bit=Pos('7BIT', save_config_string) > 0
  92.         save_href=Pos('HREF', save_config_string) > 0
  93.         save_img=Pos('IMG', save_config_string) > 0
  94.         save_script=Pos('SCRIPT', save_config_string) > 0
  95.         save_badhtml=Pos('BADHTML', save_config_string) > 0
  96.     end
  97.  
  98.     if open(print_config_fp, "ENV:HTTXprt.prefs", 'R') then do
  99.         print_config_string = ReadLN(print_config_fp)
  100.         call Close(print_config_fp)
  101.  
  102.         if Pos('LEN=',print_config_string) > 0 then
  103.             parse VAR print_config_string 'LEN='print_len . 
  104.  
  105.         if Pos('INDENT=',print_config_string) > 0 then
  106.             parse VAR print_config_string 'INDENT='print_indent . 
  107.  
  108.         if Pos('ANSIMODE=', print_config_string) > 0 then
  109.             parse VAR print_config_string 'ANSIMODE='print_ansimode . 
  110.         else if (Pos('ANSI ', print_config_string) > 0) | (right(print_config_string, 4) = 'ANSI') then
  111.             print_ansimode=2
  112.  
  113.         if Pos('ANSIMODE=', print_config_string) > 0 then
  114.             parse VAR print_config_string 'ANSIMODE='print_ansimode . 
  115.  
  116.         if Pos('ANSICOL=', print_config_string) > 0 then
  117.             parse VAR print_config_string 'ANSICOL='print_ansicol . 
  118.  
  119.         if Pos('HRMODE=',print_config_string) > 0 then
  120.             parse VAR print_config_string 'HRMODE='print_hrmode . 
  121.  
  122.         print_noalign=Pos('NOALIGN', print_config_string) > 0
  123.         print_tdeol=Pos('TDEOL', print_config_string) > 0
  124.         print_7bit=Pos('7BIT', print_config_string) > 0
  125.         print_href=Pos('HREF', print_config_string) > 0
  126.         print_img=Pos('IMG', print_config_string) > 0
  127.         print_script=Pos('SCRIPT', print_config_string) > 0
  128.         print_badhtml=Pos('BADHTML', print_config_string) > 0
  129.     end
  130.     return
  131.  
  132.  
  133. ManageGUI:
  134.     call MakeGUI()
  135.     address REXX setclip('HTTXPlugin_savedir', prefs_savedir)
  136.  
  137.     do while ~(EOF(gui_fp))
  138.         call WriteLN(gui_fp, 'continue')
  139.         gad=ReadLN(gui_fp)
  140.         select
  141.             when left(gad, 6) == 'gadget' then do
  142.                 parse VAR gad . gid value addvalue
  143.                 select
  144.                     when gid == 7 then save_len=value
  145.                     when gid == 8 then save_indent=value
  146.                     when gid == 10 then save_ansimode=value
  147.                     when gid == 11 then save_ansicol=value
  148.                     when gid == 14 then save_hrmode=value
  149.                     when gid == 16 then save_setnote=value
  150.                     when gid == 19 then save_7bit=value
  151.                     when gid == 20 then save_noalign=value
  152.                     when gid == 21 then save_tdeol=value
  153.                     when gid == 22 then prefs_save_noheader=value
  154.                     when gid == 24 then save_href=value
  155.                     when gid == 25 then save_img=value
  156.                     when gid == 26 then save_script=value
  157.                     when gid == 27 then save_badhtml=value
  158.  
  159.                     when gid == 31 then print_len=value
  160.                     when gid == 30 then print_indent=value
  161.                     when gid == 34 then print_ansimode=value
  162.                     when gid == 35 then print_ansicol=value
  163.                     when gid == 38 then print_hrmode=value
  164.                     when gid == 41 then print_7bit=value
  165.                     when gid == 42 then print_noalign=value
  166.                     when gid == 43 then print_tdeol=value
  167.                     when gid == 44 then prefs_print_noheader=value
  168.                     when gid == 46 then print_href=value
  169.                     when gid == 47 then print_img=value
  170.                     when gid == 48 then print_script=value
  171.                     when gid == 49 then print_badhtml=value
  172.  
  173.                     when gid == 52 then do
  174.                         if value > 0 then do
  175.                             prefs_savedir=addvalue
  176.                             parse VAR prefs_savedir '"'prefs_savedir'"'
  177.                         end
  178.                     end
  179.  
  180.                     when gid == 53 then prefs_donotaskdir=value
  181.                     when gid == 54 then prefs_info=value
  182.                     when gid == 55 then prefs_preview=value
  183.                     when gid == 56 then prefs_report=value
  184.  
  185.                     when gid == 58 then do
  186.                         call SaveSettings()
  187.                         call SaveSettings(1)
  188.                         call Close(gui_fp)
  189.                         exit 0
  190.                     end
  191.  
  192.                     when gid == 59 then do
  193.                         call SaveSettings()
  194.                         call Close(gui_fp)
  195.                         exit 0
  196.                     end
  197.                     when gid == 60 then do
  198.                         call Close(gui_fp)
  199.                         exit 0
  200.                     end
  201.                     otherwise nop
  202.                 end
  203.             end
  204.             when left(gad, 4) == 'menu' then do
  205.                 parse VAR gad . menu submenu subitem .
  206.                 select
  207.                     when menu == 0 then do
  208.                         if submenu == 3 then do
  209.                             call WriteLN(gui_fp, 'close')
  210.                             call Close(gui_fp)
  211.                             exit 0
  212.                         end
  213.                     end
  214.                     when menu == 1 then do
  215.                         select
  216.                             when submenu == 0 then 'OPEN "file:///AWebPath:Plugins/HTTX/HTTXPlugin.doc.html"'
  217.                             when submenu == 1 then do
  218.                                 if subitem == 0 then
  219.                                     'OPEN "file:///AWebPath:Plugins/HTTX/HTTX.doc.eng"'
  220.                                 else
  221.                                     'OPEN "file:///AWebPath:Plugins/HTTX/HTTX.doc.ita"'
  222.                             end
  223.                             otherwise nop
  224.                         end
  225.                     end
  226.                     otherwise nop
  227.                 end
  228.             end
  229.             when left(gad, 3) == 'key' then do
  230.                 parse VAR gad . key mode .
  231.                 if key == 223 then 'OPEN "file:///AWebPath:Plugins/HTTX/HTTXPlugin.doc.html"'
  232.             end
  233.             otherwise nop
  234.         end
  235.     end
  236.     call Close(gui_fp)
  237.     return
  238.  
  239.  
  240. SaveSettings:
  241.     parse ARG mode
  242.  
  243.     save_string= 'LEN='save_len 'INDENT='save_indent 'ANSIMODE='save_ansimode 'ANSICOL='save_ansicol 'HRMODE='save_hrmode 'SETNOTE='save_setnote opt_7bit.save_7bit||opt_noalign.save_noalign||opt_tdeol.save_tdeol||opt_href.save_href||opt_img.save_img||opt_script.save_script||opt_badhtml.save_badhtml
  244.     print_string='LEN='print_len 'INDENT='print_indent 'ANSIMODE='print_ansimode 'ANSICOL='print_ansicol 'HRMODE='print_hrmode opt_7bit.print_7bit||opt_noalign.print_noalign||opt_tdeol.print_tdeol||opt_href.print_href||opt_img.print_img||opt_script.print_script||opt_badhtml.print_badhtml
  245.  
  246.     if (right(prefs_savedir, 1) ~= ':') & (right(prefs_savedir, 1) ~= '/') then prefs_savedir=prefs_savedir'/'
  247.     prefs_string='prefs_savedir="'prefs_savedir'" prefs_donotaskdir="'prefs_donotaskdir'" prefs_info="'prefs_info'" prefs_preview="'prefs_preview'" prefs_report="'prefs_report'" prefs_save_noheader="'prefs_save_noheader'" prefs_print_noheader="'prefs_print_noheader'"'
  248.  
  249.     call Save('env:')
  250.     if mode=='1' then call Save('envarc:')
  251.     return
  252.  
  253.  
  254. Save:
  255.     parse ARG dest_dir
  256.  
  257.     if Open(save_config_fp, dest_dir||"HTTX.prefs", 'W') then do
  258.         Call WriteLN(save_config_fp, save_string)
  259.         Call Close(save_config_fp)
  260.     end
  261.  
  262.     if Open(print_config_fp, dest_dir||"HTTXprt.prefs", 'W') then do
  263.         Call WriteLN(print_config_fp, print_string)
  264.         Call Close(print_config_fp)
  265.     end
  266.  
  267.     if Open(plugin_config_fp, dest_dir||"HTTXPlugin.config", 'W') then do
  268.         Call WriteLN(plugin_config_fp, prefs_string)
  269.         Call Close(plugin_config_fp)
  270.     end
  271.     return
  272.  
  273.  
  274. MakeGUI:
  275.     call WriteCH(gui_fp, '"HTTX prefs editor 3.0 - press <HELP> key for help" defg fh cs ps "'awebscreen'" a v q m sk bf "AWebPath:Docs/awebbg.iff"'eol'clicktab ctl "_1 File save settings|_2 Print settings|_3 AWeb Plugin settings"'eol'menu gt "Project|About|$!HTTX AWeb plugin|$!Configuration Program|Author|$!Written by Gabriele Favrin|$!using AWNPIPE: gui|!|@QQuit"'eol'menu gt "Help|HTTX Plugin documentation|HTTX documentation|$English|$Italiano"'eol)
  276.     call WriteCH(gui_fp, 'layout b 0 v so si page 1'eol'layout b 0 rj'eol'layout b 0 v so si'eol'label gt "Line _length " ua'eol'integer chl weiw 0 arrows minc 3 maxc 3 minn 15 maxn 255 defn' save_len eol'label gt "_Indentation " ua'eol'integer chl weiw 0 arrows minc 3 maxc 3 minn 1 maxn 255 defn' save_indent eol'le'eol'layout b 0 v so si'eol'label gt "_ANSI mode " ua'eol'chooser chl weiw 0 pu cl "Disabled|Standard|Optimized " s' save_ansimode eol'label gt "ANSI c_olor " ua'eol'integer chl weiw 0 arrows minc 3 maxc 3 minn 0 maxn 9 defn' save_ansicol eol'le'eol'le'eol'layout b 0 rj'eol'layout b 0 v so si'eol'label gt "_HR draw mode " ua'eol'chooser chl weiw 0 pu cl "Disabled|ASCII|ANSI line " s' save_hrmode eol'le'eol)
  277.     call WriteCH(gui_fp, 'layout b 0 so si'eol'label gt "_Filenote type " ua'eol'chooser chl weiw 0 pu cl "None|Document title|Document URL " s' save_setnote eol'le'eol'le'eol)
  278.     call WriteCH(gui_fp, 'layout b 0'eol'layout v si b 0'eol'checkbox gt "Convert entities to _7bit ASCII " s' save_7bit eol'checkbox gt "I_gnore text and HR alignment" s' save_noalign eol'checkbox gt "Use _EOL as table cell separator " s' save_tdeol eol'checkbox gt "Suppress _Title/URL" s' prefs_save_noheader eol'le'eol'layout v si b 0'eol'checkbox gt "Include HTML Lin_k References" s' save_href eol'checkbox gt "Include I_mage Alternate Texts" s' save_img eol'checkbox gt "Include _JavaScript scripts" s' save_script eol'checkbox gt "Support _badly written HTML" s' save_badhtml eol'le'eol'le'eol'le'eol)
  279.     call WriteCH(gui_fp, 'layout b 0 v so si page 1'eol'layout b 0 rj'eol'layout b 0 v so si'eol'label gt "Line _length " ua'eol'integer chl weiw 0 arrows minc 3 maxc 3 minn 15 maxn 255 defn' print_len eol'label gt "_Indentation " ua'eol'integer chl weiw 0 arrows minc 3 maxc 3 minn 1 maxn 255 defn' print_indent eol'le'eol'layout b 0 v so si'eol'label gt "_ANSI mode " ua'eol'chooser chl weiw 0 pu cl "Disabled|Standard " s' print_ansimode eol'label gt "ANSI c_olor " ua'eol'integer chl weiw 0 arrows minc 3 maxc 3 minn 0 maxn 9 defn' print_ansicol eol'le'eol'le'eol'layout b 0 rj'eol'layout b 0 v so si'eol'label gt "_HR draw mode " ua'eol'chooser chl weiw 0 pu cl "Disabled|ASCII|ANSI line " s' print_hrmode eol'le'eol'le'eol)
  280.     call WriteCH(gui_fp, 'layout b 0'eol'layout v si b 0'eol'checkbox gt "Convert entities to _7bit ASCII " s' print_7bit eol'checkbox gt "I_gnore text and HR alignment" s' print_noalign eol'checkbox gt "Use _EOL as table cell separator " s' print_tdeol eol'checkbox gt "Suppress _Title/URL" s' prefs_print_noheader eol'le'eol'layout v si b 0'eol'checkbox gt "Include HTML Lin_k References" s' print_href eol'checkbox gt "Include I_mage Alternate Texts" s' print_img eol'checkbox gt "Include _JavaScript scripts" s' print_script eol'checkbox gt "Support _badly written HTML" s' print_badhtml eol'le'eol'le'eol'le'eol)
  281.     call WriteCH(gui_fp, 'layout sw so si v b 0 page 1'eol'layout b 0'eol'label gt "Default save _directory " ua'eol'getfile chl drawers save icons weih 0 gt "Select HTTX save directory" fn "'prefs_savedir'"'eol'le'eol'checkbox gt "Don''t as_k for save directory" s' prefs_donotaskdir eol'label gt ""'eol'checkbox gt "Include _HTTP/META header" s' prefs_info eol'label gt ""'eol'checkbox gt "Show _preview of converted document" s' prefs_preview eol'label gt ""'eol'checkbox gt "Show conversion _report" s' prefs_report eol'le'eol)
  282.     call WriteCH(gui_fp, 'space minh 0 weih 0'eol'layout so si weih 0 b 7'eol'button gt "_Save" c'eol'button gt "_Use" c'eol'button gt "_Cancel" c'eol'le'eol'open'eol)
  283.     return
  284.